package com.operate.api.operate.order.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.github.pagehelper.PageInfo;
import com.operate.api.base.ApiIndex;
import com.operate.api.base.R;
import com.operate.api.base.RestPage;
import com.operate.api.operate.opinion.domain.vo.OpinionSearchVO;
import com.operate.api.operate.opinion.domain.vo.OpinionVO;
import com.operate.api.operate.opinion.service.IOpinionService;
import com.operate.api.operate.order.domain.vo.OrderRechargeCountVO;
import com.operate.api.operate.order.domain.vo.OrderRechargeSearchVO;
import com.operate.api.operate.order.domain.vo.OrderRechargeVO;
import com.operate.api.operate.order.service.IOrderRechargeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api( tags = ApiIndex.OrderRechargeController)
@RequestMapping(value = "/api/operate/recharge")
@RestController
@SaCheckLogin
public class OrderRechargeController {


    @Autowired
    private IOrderRechargeService service;

    @ApiOperation(value = "查询订单列表")
    @GetMapping(value = "/list")
    public R<RestPage<List<OrderRechargeVO>>> list(
            @ApiParam(value = "查询参数") @ModelAttribute OrderRechargeSearchVO searchVO) {
        List<OrderRechargeVO> list = service.getList(searchVO);
        RestPage restPage = new RestPage( new PageInfo(list),list);
        return new R(restPage);
    }



    @ApiOperation(value = "查询统计")
    @GetMapping(value = "/count")
    public R<OrderRechargeCountVO> count() {
        OrderRechargeCountVO count = service.countRecharge();
        return new R(count);
    }






}
